<%' VB Script Document
function ErrorHandler (continue)
	dontemail=false
	msg=""
	msg=msg & "Error Has occured.<br>" 
	select case err.number
	 	case -2147220975,-2147220973

			msg=msg & "Error Number: " & err.number & "<br>" 
			msg=msg & "Error Description: " & err.description & "<br>" 
			msg=msg & "Email Server (local variable) : '" & EmailServer & "'<BR>" 
	 		msg=msg & "Email Server (application variable) : '" & application("EmailServer")  & "'<BR>" 
			msg=msg & "File = " & request.servervariables("SERVER_NAME") & "/" & request.servervariables("SCRIPT_NAME") & "<br>"
			msg=msg & "MachineID = " & request.cookies ("HSmachineID") & "<br>"
			dontemail=true
						
		case else
	 		Set objErrorInfo = Server.GetLastError
	 		
			msg=msg & "Error Number: " & err.number & "<br>" 
			msg=msg & "Error Description: " & err.description & "<br>" 
			msg=msg & "ASPCode = " & objErrorInfo.ASPCode & "<br>" 
			msg=msg & "ASPDescription = " & objErrorInfo.ASPDescription & "<br>" 
			msg=msg & "Category = " & objErrorInfo.Category & "<br>" 
			msg=msg & "Column = " & objErrorInfo.Column & "<br>" 
			msg=msg & "Description = " & objErrorInfo.Description & "<br>" 
			msg=msg & "File = " & objErrorInfo.File & "<br>" 
			msg=msg & "Line = " & objErrorInfo.Line & "<br>" 
			msg=msg & "Number = " & objErrorInfo.Number & "<br>" 
			msg=msg & "Source = " & objErrorInfo.Source & "<br>" 
			msg=msg & "File = " & request.servervariables("SERVER_NAME") & "/" & request.servervariables("SCRIPT_NAME") & "<br>"
			msg=msg & "MachineID = " & request.cookies ("HSmachineID") & "<br>"
			
	end select

	response.write (msg)

	set logconn=server.createobject("adodb.connection")
	set logrs=server.createobject("adodb.recordset")

	logfile=server.mappath ("access/backend/log.mdb")
	logconn.open ("Provider=Microsoft.Jet.OLEDB.4.0;data source=" & logfile)
	logsql="select top 1 * from errorlog"
	logrs.open logsql,logconn,1,2
	logrs.addnew
		logrs("enum")=err.number
		logrs("edescription")=replace(msg,"<br>",vbcrlf)
		logrs("etime")=now()
		logrs("emachineID")=request.cookies("HSmachineID")
	logrs.update
	logrs.close
	logconn.close
	set logrs=nothing
	set logconn=nothing
	
	if continue="no" then response.end()

end function
%>
